package org.example.controller;
        import org.example.entity.Student;
        import org.example.service.StudentService;
        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.web.bind.annotation.*;
        import java.util.List;
@RestController
 public class StudentController{
@Autowired
 private StudentService studentService;
@RequestMapping("/create")
 public String create(){
         studentService.createTableStudent();
         return"已执行创建命令，请前往数据库查看。";
         }
@RequestMapping("/save")
 public int save(@ModelAttribute Student student){
        return studentService.saveStudent(student);
        }
@RequestMapping("/update")
 public int update(@ModelAttribute Student student){
        return studentService.updateStudent(student);
        }
@RequestMapping("/getAll")
 public List<Student> getAll(){
        return studentService.getAllStudent();
        }
@RequestMapping("/getById")
 public Student getById(@RequestParam String id){
        return studentService.getStudentById(id);
        }
@RequestMapping("/delete")
 public int delete(@RequestParam String id){
        return studentService.deleteStudent(id);
        }
        }